﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Himp.Platform.Dc.Migrations
{
    /// <inheritdoc />
    public partial class modify_DiagTypeDict_ver : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "PINYIN_MEMO",
                schema: "Dc",
                table: "DIAG_TYPE_DICT");

            migrationBuilder.DropColumn(
                name: "Ver",
                schema: "Dc",
                table: "DIAG_TYPE_DICT");

            migrationBuilder.DropColumn(
                name: "WUBI_MEMO",
                schema: "Dc",
                table: "DIAG_TYPE_DICT");

            migrationBuilder.AlterColumn<string>(
                name: "CLNC_DIAG_NAME",
                schema: "Dc",
                table: "HI_DIAG_DICT",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "text");

            migrationBuilder.AlterColumn<string>(
                name: "CLNC_DIAG_CODE",
                schema: "Dc",
                table: "HI_DIAG_DICT",
                type: "text",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "text");

            migrationBuilder.CreateTable(
                name: "TCM_DISE_DICT",
                schema: "Dc",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    TCM_DISE_CODE = table.Column<string>(type: "text", nullable: false),
                    TCM_DISE_NAME = table.Column<string>(type: "text", nullable: false),
                    VER = table.Column<int>(type: "integer", nullable: false),
                    PINYIN_MEMO = table.Column<string>(type: "text", nullable: false),
                    WUBI_MEMO = table.Column<string>(type: "text", nullable: false),
                    IsDeleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "uuid", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TCM_DISE_DICT", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "TCMSYMP_DICT",
                schema: "Dc",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "uuid", nullable: false),
                    TCMSYMP_CODE = table.Column<string>(type: "text", nullable: false),
                    TCMSYMP_NAME = table.Column<string>(type: "text", nullable: false),
                    VER = table.Column<int>(type: "integer", nullable: false),
                    PINYIN_MEMO = table.Column<string>(type: "text", nullable: false),
                    WUBI_MEMO = table.Column<string>(type: "text", nullable: false),
                    IsDeleted = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
                    TenantId = table.Column<Guid>(type: "uuid", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TCMSYMP_DICT", x => x.Id);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "TCM_DISE_DICT",
                schema: "Dc");

            migrationBuilder.DropTable(
                name: "TCMSYMP_DICT",
                schema: "Dc");

            migrationBuilder.AlterColumn<string>(
                name: "CLNC_DIAG_NAME",
                schema: "Dc",
                table: "HI_DIAG_DICT",
                type: "text",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "text",
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "CLNC_DIAG_CODE",
                schema: "Dc",
                table: "HI_DIAG_DICT",
                type: "text",
                nullable: false,
                defaultValue: "",
                oldClrType: typeof(string),
                oldType: "text",
                oldNullable: true);

            migrationBuilder.AddColumn<string>(
                name: "PINYIN_MEMO",
                schema: "Dc",
                table: "DIAG_TYPE_DICT",
                type: "text",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Ver",
                schema: "Dc",
                table: "DIAG_TYPE_DICT",
                type: "integer",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "WUBI_MEMO",
                schema: "Dc",
                table: "DIAG_TYPE_DICT",
                type: "text",
                nullable: true);
        }
    }
}
